#ifndef _H_WINELMT
#define _H_WINELMT

#include <windows.h>
#include <string>
#include "input.h"

#include "styleSheet.h"

class window;
class fieldSet;

#define OVER_TAKEN      0x01
#define ACTIVE_TAKEN    0x02
#define NOT_ACTIVABLE   0x04

class window;

class winElmt{

    protected:
        window* parentWin;
        fieldSet* parentSet;

        RECT    enc;

        string  ELname;

        bool    mouseOver;
        bool    active;
        bool    dragging;
        bool    inActivable;
        bool    useLayout;

        bool    left_pressed;
        bool    left_released;

        int     oldX,oldY;
        int     dragBX,dragBY;

        styleSheet* styleS;

        winElmt* nextFocus;

    public:
        winElmt();
        winElmt(window*);
        virtual ~winElmt();

        virtual void setParentWin(window*);
        virtual void setParentSet(fieldSet*);
        virtual fieldSet* getParentSet();

        void setRect(RECT);
        RECT getRect();
        int getWidth();
        int getHeight();
        void setWidth(int);
        virtual void setHeight(int);
        void setPos(int,int);
        void getPos(int*,int*);
        void setRect(int,int,int,int);

        void setInactivable(bool);
        bool getInactivable();

        string getELname();

        void setStyle(styleSheet*);
        void setNextFocus(winElmt*);

        void move(int,int);

        bool isMouseOver();
        bool isActive();

        virtual color* bkgColFromSS(elTy);
        virtual color* txtColFromSS(elTy);

        virtual void getOffset(int*,int*);

        virtual void display();
        virtual void display_end();
        virtual unsigned char eventExec(unsigned char);

        virtual void activeGetEvent();
        virtual void activeLoseEvent();

        virtual void mouseGetOverEvent();
        virtual void mouseQuitOverEvent();

        virtual void dragEvent(int,int,int,int);
        virtual void draggingEvent(int,int);

        virtual void mousePushEvent(int);
        virtual void mouseReleaseEvent(int);
        virtual void mouseClickEvent(int);

};

#endif
